"""
闭包
"""
def outer():
  a = 2
  def inner():
    nonlocal a
    a += 1
    return a
  return inner

result = outer()
print(result())
print(result())
print(result())

def outer():
  a = 2
  def inner():
    nonlocal a
    a += 1
  inner()
  return a

print(outer())
